package ioTest;

import java.io.*;

/**
 * 对象流写出对象
 */
public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name = "张三";
        int age = 22;
        String gender = "男";
        String[] otherInfo = {"是一个大学生",",家住安徽",",喜欢打篮球...."};

        Student zs = new Student(name,age,gender,otherInfo);
        System.out.println(zs);

        FileOutputStream fos = new FileOutputStream("fos.txt");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(zs);//将zs写出到fos.txt
        System.out.println("写出完成");
        oos.close();//关闭流











    }
}
